/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Behaviors.Schemas.Motor;

import Behaviors.Schemas.*;
import Behaviors.Schemas.Perception.*;
import Utils.*;
import Robot.*;
/**
 *
 * @author alejo
 */
public class NxMSAvoidPast extends Behavior{

    Behavior detect;

    public NxMSAvoidPast(String name, Behavior detect)
    {
        super(name);
        this.detect = detect;
    }
    public Vector2d Value()
    {
        Vector2d result = new Vector2d(0,0,Vector2d.MODE_XY);

        result = ((NxPSLocalizePast)detect).Value();

        result.setMag((float)result.getMag()*-1);

        if(result.getMag() > 1)
            result.setMag(1);

        result.setMag(1-(float)result.getMag());

        System.out.println("Vector de avoidPast");
        result.print(Vector2d.MODE_MA);
        
        return result;
    }
}
